using System;
using System.Collections;
using System.Collections.Generic;
using System.Text;
using System.Diagnostics;

namespace XMindExporter
{
    public enum PackageType
    {
        Setting,
        Output,
        Num
    };
 
    public class Package : CollectionBase
    {
        private string name;
        private PackageType type;

        public string Name
        {
            get { return this.name; }
        }
        public PackageType Type
        {
            get { return this.type; }
        }

        public Package(string name, PackageType type)
        {
            this.name = name;
            this.type = type;
        }

        public void Add(Parameter value)
        {
            this.List.Add(value);
        }

        protected override void OnValidate(Object value)
        {
            // this collection contains MissionPluginParameter only!
            if (value.GetType() != typeof(Parameter))
            {
                throw new ArgumentException("value must be of type Parameter.", "value");
            }
            else
            {
                Parameter newParameter = (Parameter)value;
                newParameter.Validate(this.type);
            }
        }

        public void GetParameters(out List<Parameter> parameters)
        {
            parameters = new List<Parameter>();
            foreach (Parameter parameterOn in this.List)
	        {
                parameters.Add(parameterOn);
	        }
        }
    }
}
